
malloc1.o:     file format elf32-littlearm


Disassembly of section .text:

00000000 <main>:
#include <unistd.h>

#define A_MEGABYTE (1024 * 1024)

int main()
{
   0:	e92d4800 	push	{fp, lr}
   4:	e28db004 	add	fp, sp, #4
   8:	e24dd010 	sub	sp, sp, #16
  char * some_memory;
  int megabyte = A_MEGABYTE;
   c:	e3a03601 	mov	r3, #1048576	; 0x100000
  10:	e50b300c 	str	r3, [fp, #-12]  ; megabyte = 0x100000
  int exit_code = EXIT_FAILURE;
  14:	e3a03001 	mov	r3, #1
  18:	e50b3008 	str	r3, [fp, #-8] ; exit_code = 1

  some_memory = (char *)malloc(megabyte);
  1c:	e51b300c 	ldr	r3, [fp, #-12]  ; r3 = megabyte
  20:	e1a00003 	mov	r0, r3          ; r0 = megabyte
  24:	ebfffffe 	bl	0 <malloc>
  28:	e1a03000 	mov	r3, r0
  2c:	e50b3010 	str	r3, [fp, #-16] ; some_memory ---> malloc request memory
  if (some_memory != NULL) {
  30:	e51b3010 	ldr	r3, [fp, #-16] ; some_memory ---> malloc request memory
  34:	e3530000 	cmp	r3, #0         ; ?= 0
  38:	0a00000b 	beq	6c <main+0x6c>
    sprintf(some_memory, "Hello World\n");
  3c:	e51b3010 	ldr	r3, [fp, #-16]   ; r3 = malloc request memory
  40:	e59f202c 	ldr	r2, [pc, #44]	; 74 <main+0x74>    parameter
  44:	e1a00003 	mov	r0, r3
  48:	e1a01002 	mov	r1, r2
  4c:	e3a0300d 	mov	r3, #13 ; length
  50:	e1a02003 	mov	r2, r3
  54:	ebfffffe 	bl	0 <memcpy>
    printf("%s", some_memory);
  58:	e51b1010 	ldr	r1, [fp, #-16] ; r3 = malloc request memory
  5c:	e59f0014 	ldr	r0, [pc, #20]	; 78 <main+0x78>
  60:	ebfffffe 	bl	0 <printf>
    exit_code = EXIT_SUCCESS;
  64:	e3a03000 	mov	r3, #0
  68:	e50b3008 	str	r3, [fp, #-8] ; exit_code = 0
  }

  exit(exit_code);
  6c:	e51b0008 	ldr	r0, [fp, #-8]
  70:	ebfffffe 	bl	0 <exit>
  74:	00000000 	.word	0x00000000
  78:	00000010 	.word	0x00000010
